**********************************************************************************  
* Replication file: Transparency and support for aid - experiments
*
* Contact: mirko.heinzel@glasgow.ac.uk
**********************************************************************************

* Data
******

  clear all
  use "DOTRAN_experiment", clear

  replace pastvote_ge_2019=999 if pastvote_ge_2019==.
  label define pastvote_ge_2019 999 "Did not vote"

* Main effects
**************

  reghdfe q4_1 i.treatment [pw = W8] , noabsorb
  margins, over(treatment)
  marginsplot, recast(bar) ytitle("Support for Aid")  ylabel(4(0.5)6)

* Interactions

  reghdfe q4_1 i.treatment [pw = W8] , noabsorb
  eststo m1

  reghdfe q4_1 i.treatment##c.spending_good uk_civtrust uk_govtrust [pw = W8] , noabsorb
  eststo m2

  reghdfe q4_1 i.treatment##c.uk_civtrust spending_good uk_govtrust [pw = W8] , noabsorb
  eststo m3

  reghdfe q4_1 i.treatment##c.uk_govtrust uk_civtrust spending_good [pw = W8] , noabsorb
  eststo m4

  reghdfe q4_1 i.treatment##c.uk_govtrust i.treatment##c.uk_civtrust i.treatment##c.spending_good  [pw = W8] , noabsorb
  eststo m5

estout m*, drop(*0.* _*) starlevels(* .1  ** .05  *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N r2, fmt(0 3)) 


  label define treatmentl 0 "No" 1 "Yes" 
  label values treatment treatmentl  

  reg q4_1 i.treatment##c.uk_civtrust spending_good uk_govtrust [pw = W8] 
  *** ssc install marhis, replace ***
  marhis uk_civtrust, cate(treatment) percent discrete points(3) label(2)


* Conjoint tables
*****************

* Number of features

  clear all
  use "DOTRAN_experiment", clear

  drop q_attr1_concept1_task1 q_attr1_concept2_task1 q_attr2_concept1_task1 q_attr2_concept2_task1 q_attr3_concept1_task1 q_attr3_concept2_task1 q_attr4_concept1_task1 q_attr4_concept2_task1 q_attr5_concept1_task1 q_attr5_concept2_task1 q_attr6_concept1_task1 q_attr6_concept2_task1 q_attr7_concept1_task1 q_attr7_concept2_task1

  reshape long q_attr, i(Identity) j(choicetext, string)
  split choicetext, p("_")

  tostring choicetext1, replace
  replace choicetext1= "strategy" if choicetext1=="1"
  replace choicetext1= "decision_making" if choicetext1=="2"
  replace choicetext1= "structure" if choicetext1=="3"
  replace choicetext1= "operational_costs" if choicetext1=="4"
  replace choicetext1= "staff" if choicetext1=="5"
  replace choicetext1= "project" if choicetext1=="6"

  egen respondent_profile=group(Identity choicetext2)
  drop choicetext
  reshape wide q_attr, i(respondent_profile) j(choicetext1, string)

  gen support=q5_1 if choicetext2=="concept1"
  replace support=q5_2 if choicetext2=="concept2"

  label define mylabel11 1 "Decision-making: Yes" 2 "No"
  label define mylabel12 1 "Overheads: Yes" 2 "No"
  label define mylabel13 1 "Project: Yes" 2 "No"
  label define mylabel14 1 "Staff: Yes" 2 "No"
  label define mylabel15 1 "Strategy: Yes" 2 "No"
  label define mylabel16 1 "Structure: Yes" 2 "No"

  label values q_attrdecision_making mylabel11
  label values q_attroperational_costs mylabel12
  label values q_attrproject mylabel13
  label values q_attrstaff mylabel14
  label values q_attrstrategy mylabel15
  label values q_attrstructure mylabel16

  gen added_features=(q_attrdecision_making+q_attroperational_costs+q_attrproject+q_attrstaff+q_attrstrategy+q_attrstructure-6)
  replace added_features=7-added_features

  reghdfe support i.added_features , noabsorb cluster(Identity)
  eststo m1

estout m1, drop(*1.* _*) starlevels(* .1  ** .05  *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N r2, fmt(0 3)) 


* Types of transparency

  reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure , noabsorb cluster(Identity)
  margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
  eststo conjoint2
  coefplot conjoint2 , xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)

  
* Other reforms

  clear all
  use "DOTRAN_experiment", clear

  drop q_attr1_concept1_task1_C2 q_attr1_concept2_task1_C2 q_attr2_concept1_task1_C2 q_attr2_concept2_task1_C2 q_attr3_concept1_task1_C2 q_attr3_concept2_task1_C2 q_attr4_concept1_task1_C2 q_attr4_concept2_task1_C2 q_attr5_concept1_task1_C2 q_attr5_concept2_task1_C2 q_attr6_concept1_task1_C2 q_attr6_concept2_task1_C2

  reshape long q_attr, i(Identity) j(choicetext, string)
  split choicetext, p("_")

  tostring choicetext1, replace
  replace choicetext1= "transparency" if choicetext1=="1"
  replace choicetext1= "anti_corruption" if choicetext1=="2"
  replace choicetext1= "allies" if choicetext1=="3"
  replace choicetext1= "poverty" if choicetext1=="4"
  replace choicetext1= "human_rights" if choicetext1=="5"
  replace choicetext1= "climate" if choicetext1=="6"
  replace choicetext1= "coordination" if choicetext1=="7"

  egen respondent_profile=group(Identity choicetext2)
  drop choicetext
  reshape wide q_attr, i(respondent_profile) j(choicetext1, string)

  gen support=q3_1 if choicetext2=="concept1"
  replace support=q3_2 if choicetext2=="concept2"

  label define mylabel11 1 "Transparency: Yes" 2 "No"
  label define mylabel12 1 "Political allies: Yes" 2 "No"
  label define mylabel13 1 "Anti-corruption: Yes" 2 "No"
  label define mylabel14 1 "Climate change: Yes" 2 "No"
  label define mylabel15 1 "Coordination: Yes" 2 "No"
  label define mylabel16 1 "Human rights: Yes" 2 "No"
  label define mylabel17 1 "Poverty: Yes" 2 "No"

  label values q_attrtransp mylabel11
  label values q_attrallies mylabel12
  label values q_attranti_ mylabel13
  label values q_attrclimate mylabel14
  label values q_attrcoord mylabel15
  label values q_attrhuman_ mylabel16
  label values q_attrpoverty mylabel17
  
  reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty [pw = W8], noabsorb cluster(Identity)
  margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
  eststo conjoint1
  coefplot conjoint1 , xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)  

    
* Appendix
**********

* Experiment 1

clear all
use "DOTRAN_experiment", clear
  
replace pastvote_ge_2019=999 if pastvote_ge_2019==.
label define pastvote_ge_2019 999 "Did not vote"

*party support
*conservative
reg q4_1 i.treatment if pastvote_ge_2019==1
eststo m1

*labour
reg q4_1 i.treatment if pastvote_ge_2019==2
eststo m2

*remain
reg q4_1 i.treatment if pastvote_EURef==1
eststo m3

*leave
reg q4_1 i.treatment if pastvote_EURef==2
eststo m4

esttab m1 m2 m3 m4, star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(4) r2 se mlabels(,titles)  l 


*no weighting
reg q4_1 i.treatment 
eststo m5

esttab m5 , star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(4) r2 se mlabels(,titles)  l 

*question order
reghdfe q4_1 i.treatment [pw = W8], absorb(q1_q5_ord)
eststo m6

esttab m6 , star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(4) r2 se mlabels(,titles)  l 

*demographics
reg q4_1 i.treatment i.profile_gender i.profile_socialgrade_cie i.profile_GOR i.pastvote_ge_2019 i.pastvote_EURef i.profile_house_tenure i.profile_education_level [pw = W8] 
eststo m7

esttab m7, star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(4) r2 se mlabels(,titles)  l 


* Experiment 2

clear all
use "DOTRAN_experiment", clear

drop q_attr1_concept1_task1 q_attr1_concept2_task1 q_attr2_concept1_task1 q_attr2_concept2_task1 q_attr3_concept1_task1 q_attr3_concept2_task1 q_attr4_concept1_task1 q_attr4_concept2_task1 q_attr5_concept1_task1 q_attr5_concept2_task1 q_attr6_concept1_task1 q_attr6_concept2_task1 q_attr7_concept1_task1 q_attr7_concept2_task1

reshape long q_attr, i(Identity) j(choicetext, string)
split choicetext, p("_")

tostring choicetext1, replace
replace choicetext1= "strategy" if choicetext1=="1"
replace choicetext1= "decision_making" if choicetext1=="2"
replace choicetext1= "structure" if choicetext1=="3"
replace choicetext1= "operational_costs" if choicetext1=="4"
replace choicetext1= "staff" if choicetext1=="5"
replace choicetext1= "project" if choicetext1=="6"

egen respondent_profile=group(Identity choicetext2)
drop choicetext
reshape wide q_attr, i(respondent_profile) j(choicetext1, string)


gen support=q5_1 if choicetext2=="concept1"
replace support=q5_2 if choicetext2=="concept2"

label define mylabel11 1 "Decision-making: Yes" 2 "No"
label define mylabel12 1 "Overheads: Yes" 2 "No"
label define mylabel13 1 "Project: Yes" 2 "No"
label define mylabel14 1 "Staff: Yes" 2 "No"
label define mylabel15 1 "Strategy: Yes" 2 "No"
label define mylabel16 1 "Structure: Yes" 2 "No"

label values q_attrdecision_making mylabel11
label values q_attroperational_costs mylabel12
label values q_attrproject mylabel13
label values q_attrstaff mylabel14
label values q_attrstrategy mylabel15
label values q_attrstructure mylabel16

*conservative
reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure  [pw = W8] if pastvote_ge_2019==1, noabsorb cluster(Identity)
margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
eststo conjointA1
coefplot conjointA1, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   name(approval_graph, replace)

*labour
reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure  [pw = W8] if pastvote_ge_2019==2, noabsorb cluster(Identity)
margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
eststo conjointA2
coefplot conjointA2, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   name(approval_graph, replace)

*remain
reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure  [pw = W8] if pastvote_EURef==1, noabsorb cluster(Identity)
margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
eststo conjointA3
coefplot conjointA3, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   name(approval_graph, replace)

*brexit
reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure  [pw = W8] if pastvote_EURef==2, noabsorb cluster(Identity)
margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
eststo conjointA4
coefplot conjointA4, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   name(approval_graph, replace)

*no weighting
reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure  , noabsorb cluster(Identity)
margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
eststo conjointA5
coefplot conjointA5, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   name(approval_graph, replace)

*question order
reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure  , absorb(q1_q5_ord) cluster(Identity)
margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
eststo conjointA6
coefplot conjointA6, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   name(approval_graph, replace)

*demographics
reghdfe support i.q_attrdecision_making i.q_attroperational_costs i.q_attrproject i.q_attrstaff i.q_attrstrategy i.q_attrstructure  i.profile_gender i.profile_socialgrade_cie i.profile_GOR i.pastvote_ge_2019 i.pastvote_EURef i.profile_house_tenure i.profile_education_level, noabsorb cluster(Identity)
margins q_attrdecision_making q_attroperational_costs q_attrproject q_attrstaff q_attrstrategy q_attrstructure , atmeans post
eststo conjointA7
coefplot conjointA7, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   name(approval_graph, replace)


* Experiment 3 

clear all
use "DOTRAN_experiment", clear

drop q_attr1_concept1_task1_C2 q_attr1_concept2_task1_C2 q_attr2_concept1_task1_C2 q_attr2_concept2_task1_C2 q_attr3_concept1_task1_C2 q_attr3_concept2_task1_C2 q_attr4_concept1_task1_C2 q_attr4_concept2_task1_C2 q_attr5_concept1_task1_C2 q_attr5_concept2_task1_C2 q_attr6_concept1_task1_C2 q_attr6_concept2_task1_C2

reshape long q_attr, i(Identity) j(choicetext, string)
split choicetext, p("_")

tostring choicetext1, replace
replace choicetext1= "transparency" if choicetext1=="1"
replace choicetext1= "anti_corruption" if choicetext1=="2"
replace choicetext1= "allies" if choicetext1=="3"
replace choicetext1= "poverty" if choicetext1=="4"
replace choicetext1= "human_rights" if choicetext1=="5"
replace choicetext1= "climate" if choicetext1=="6"
replace choicetext1= "coordination" if choicetext1=="7"

egen respondent_profile=group(Identity choicetext2)
drop choicetext
reshape wide q_attr, i(respondent_profile) j(choicetext1, string)

gen support=q3_1 if choicetext2=="concept1"
replace support=q3_2 if choicetext2=="concept2"

*party support
label define mylabel1 1 "Transparency: Yes" 2 "No"
label define mylabel2 1 "Political allies: Yes" 2 "No"
label define mylabel3 1 "Anti-corruption: Yes" 2 "No"
label define mylabel4 1 "Climate change: Yes" 2 "No"
label define mylabel5 1 "Coordination: Yes" 2 "No"
label define mylabel6 1 "Human Rights: Yes" 2 "No"
label define mylabel7 1 "Poverty: Yes" 2 "No"

label values q_attrtransparency mylabel1
label values q_attrallies mylabel2
label values q_attranti_corruption mylabel3
label values q_attrclimate mylabel4
label values q_attrcoordination mylabel5
label values q_attrhuman_rights mylabel6
label values q_attrpoverty mylabel7


*conservative
reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty [pw = W8] if pastvote_ge_2019==1, noabsorb cluster(Identity)
margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
eststo conjointA8
coefplot conjointA8, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   

*labour
reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty [pw = W8] if pastvote_ge_2019==2, noabsorb cluster(Identity)
margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
eststo conjointA9
coefplot conjointA9, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   

*remain
reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty [pw = W8] if pastvote_EURef==1, noabsorb cluster(Identity)
margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
eststo conjointA10
coefplot conjointA10, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   

*brexit
reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty [pw = W8] if pastvote_EURef==2, noabsorb cluster(Identity)
margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
eststo conjointA11
coefplot conjointA11, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   

*no weighting
reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty , noabsorb cluster(Identity)
margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
eststo conjointA12
coefplot conjointA12, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   

*question order
reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty , absorb(q1_q5_ord) cluster(Identity)
margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
eststo conjointA13
coefplot conjointA13, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   


*demographics
reghdfe support i.q_attrtransparency i.q_attrallies i.q_attranti_corruption i.q_attrclimate i.q_attrcoordination i.q_attrhuman_rights i.q_attrpoverty i.profile_gender i.profile_socialgrade_cie i.profile_GOR i.pastvote_ge_2019 i.pastvote_EURef i.profile_house_tenure i.profile_education_level, noabsorb cluster(Identity)
margins q_attrtransparency q_attrallies q_attranti_corruption q_attrclimate q_attrcoordination q_attrhuman_rights q_attrpoverty , atmeans post
eststo conjointA14
coefplot conjointA14, xtitle(Marginal Means) scheme(plotplainblind) xlabel(4(0.5)6)   


* Cross-sectional analysis --> "DOTRAN_countries.do"

